//
//  QJSCollectionViewCell.m
//  aEP项目A
//
//  Created by lanou3g on 16/4/19.
//  Copyright © 2016年 qiu. All rights reserved.
//

#import "QJSCollectionViewCell.h"

@interface QJSCollectionViewCell ()

@property (weak, nonatomic) IBOutlet UIImageView *imageView;

@property (weak, nonatomic) IBOutlet UILabel *titleLabel;


@end

@implementation QJSCollectionViewCell



- (void)setModel:(QJSHomeModel *)model{
    if (_model != model) {
        _model = model;
    }
    }

- (void)layoutSubviews{
    self.titleLabel.text = self.model.name;
    NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:self.model.coverimg]];
    NSURLSessionDataTask *dataTask =[[NSURLSession sharedSession]dataTaskWithRequest:request completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {
        
        if (data) {
            dispatch_async(dispatch_get_main_queue(), ^{
                self.imageView.image = [UIImage imageWithData:data];
            });
        }
    }];
    [dataTask resume];
    
}

- (void)awakeFromNib {
    // Initialization code
}

@end
